FC Coding is
One step from 1st Principles to Solution!

Home



Oil Refinery Production Model

Problem Description: An oil company may have many different distillation processes going on at each of its refineries. Each time new crude oil arrives at a refinery, or one distillation unit goes in or out of service, a new tweaking of all distillation parameters must be done in order to maximize the company’s profit.

Goal for this page: simulate entire refinery's productions. Does output agree with present day's simulation of each refinery? If results agree to at least a 5 digit accuracy then on to the next refinery; otherwise, you must justify why the results differ so.


Here we will assume that the company has ‘nDistillUnits’ at each refinery and ‘nRefineries’ for total number of refineries. The real issue will be agreeing on the company objective(s). Here we will use maximize profit while minimizing pollution.

A Oil Refinery showing all its activitiesMarketing effects: pollution is mainly seen as a cost item, but does it provide some profit to a company who’s marketing group properly advertises the product as a ‘green’ product or has no detrimental chemicals in it? Check with your marketing group to create a math model showing some profit from products that have minimized pollution and add that model to this Oil Production program.

A monitor of present in stock inventories would be helpful for instant updating of ones model as used here.

Refinery Buy/Sell Options: Once one runs this Oil Production program a few times and is confident in its results, it would be time to start using it to play ‘what if’ games. For example, what if another ‘B’ refinery was up for sale and your company was trying to decide whether to buy it. Say this ‘B’ refinery is the same relative size with the same number of distillation units as your ‘A’ refinery, just a different location. Copy your refinery ‘A’ and add the 'B' refinery with a new location and re-run it. The resulting increase or decrease in ‘profit’ will help your company decide to reject ‘B’ refinery or make an offer. Changing a refineries location will affect the distribution cost of your products. A new location might have a better grade of crude oil; another variable to test and see if the new value is worth it from a computer simulation view point.

Another use of this program would be deciding which refinery should get a new distillation unit first. Every one wants to have the latest gadgets in their backyard to show off but these can be very very expensive. So use this program to add a new unit to each refinery one at a time. This should give you some evidence to which site to start implementing new distillation units too.

Computer Code

Our objective in the first level (or outer) find statement is to determine how much of the various products to produce at various refineries in order to maximize the companies profit.

FIND supplyEst; IN refineries; BY JUPITER;
MATCHING supplyErr; TO MAXIMIZE profit

The goal of 2nd level find statement is to determine product quantities to manufacture at each refinery and minimize pollution in the process. Limits are added to insure that the quantities are above some set values and below other values. Setting the upper limit to the lower limit will stop production of that one product; e.g. low(3) equals hi(3) then product(3) will be zero. There is another constraint that needs to be added to the 2nd level find statement. The total crude oil processed at each refinery must equal the total crude oil available; no more, no less. ‘Matching crudeErr’ addition to this 2nd ‘find’ statement will ensure the variable ‘crudeErr’ is (near) zero.

FIND supplyQty; IN distillation; BY JOVE;
with UPPER hi and LOWER low;
MATCHING crudeErr; TO MINIMIZE pollution

The following is just a rough sketch of necessary code to solve such a problem. Calculating the cost of manufacturing and distribution, pollution, profits of each product, etc. are left to the user. Each of these variables may require a math model of their own and knowledgeable people to be accurate enough for this Oil Production program.

global all problem OilProduction nRefineries = 22: nProducts = 33 dynamic hi, low, totCrudeIn, ooo call setup ! initial values call history ! extrapolate 4 today’s usage ! find product percentages for all Refineries in order to maximize profit. find supplyEst; in refineries; by jupiter; matching supplyErr; to maximize profit End model refineries pollution = 0: profit = 0: cost = 0: supplyErr = 0 do i = 1, nRefineries do j = 1, nDistillUnits(i) do k = 1, nProducts supplyQty(k) = supplyEst(i,j,k) end do end do crudeUsed = 0: crudeErr = 0 ! finds qty production @ each refinery to minimize overall pollution ! to restrict 'supplyQty(j)' to equal 'supplyEst(j)' find supplyQty; in processing; by Jove; with upper hi; and lower low; matching crudeErr; to minimize pollution do j = 1, nProducts supplyErr = supplyErr + (supplyQty(j) - supplyEst(i, j))**2 end do end do ! find best routes to deliver products ooo find routes in distribution ooo to minimize distPollution profit = ??? ! calculate / measure it! cost = ??? ! ditto profit = profit - cost end model distribution ooo

This example shows nesting of find statements that will help maximize productivity. Getting agreement on what a company's objective is or should be may, take some time. It is hoped that this example will aide you on solving your problem with Calculus (Level) programming. Solve not just one equation but your entire problem/project in one program!

Influential Parameters: Grade of crude oil, air quality, types of distillation units available, number of distillation units available, etc. at each refinery are important parameters that will be necessary for this program to find the optimum solution for each time it is executed. These parameters need to be included in ones math model. Such parameters (and their derivatives) will aide the built-in solvers in finding the amounts, locations, & distillation units at each refinery in order to maximum company’s profit.

A Oil Refinery's controls for one distillation unitFindings: A computer simulation may look good on paper but implementing the method may be a problem. In the 1960s or 70s, the Chevron refinery at Richmond, CA implemented a computerized monitoring system at each of their control rooms. It was found that the average employee started their eight hour shift by tweaking their controls to settings that they new were safe. For the rest of their shift they read books or did other things of self interest. Then the computer monitor was turned on, along with the plant manager telling these controllers that they could earn gold or silver or red stars as rewards for doing a good job of improving oil production. The computer monitors would ‘watch’ empolyee tweaking. If they went into an unsafe zone for any control, it would stop them. After a few weeks most controllers were tweaking their controls to maximize some oil production and thus were receiving some gold/silver/red stars :)

This monitoring program built in-house competition that resulted in a huge increase in productivity. (I don’t know prices of the 1960s or 70s. Let’s use today’s prices for this example.) Say that crude oil cost $50 / barrel and after refinement, sold for $100 / barrel. One element in the refining process was Black Gold. Say it increased one once per barrel. Today, Gold is selling for above $1,100 per ounce. Thus, this competition with computer monitoring, yielded a $1,000 / barrel interest in profit; a ten fold increase!

We are not talking peanuts here.

Computer Output: What if an output listing shows zero volume of oil should be produced by the kth distillation unit at the jth refinery. If it continually shows a zero volume for several weeks, then it might be saying its time to replace the unit. Or, maybe you need to add a new product such as the tire companies did when they added shoes to their production line. Time to think outside the box.

Future: Maintaining a program such as the one described here is relatively simple. If the number of products or refineries or distillation models changes then update the number in code. If the company objective changes then some more code may need to be added and/or deleted. It’s pretty simple!

Keeping your distillation (math) models updated is essential. Each refinery must routinely verify that the models are correct for their refinery. Here is where you will spend most of your time for keeping this type program valid.

A Picture Worth a 1,000 words!Communication:Have you seen movie Hidden Figures, if you haven’t seen it, you should. It may help understand the communication problem between different types of people; e.g. NASA’s Engineers, Scientists, and Mathematicians. The movie shows engineers trying to solve some equations and getting no where fast! A mathematician comes along and solves the problem. But numbers say little to engineers. Near the movie’s end, the mathematician draws a graph showing a solution point. The engineers finally get the ‘picture’ of what the equations are trying to say to them. Remember, a picture is worth a 1,000 words, right?

Feedback Request: How many companies are interested in solving their similar problem? At present, this program may not work due to amount of storage necessary. In order to fix this storage problem, we need your values for ‘nRefineries’ and ‘nProducts’. The product of nRefineries * nProducts may be the problem. Assume each is 100 then their product is 10,000 (1E4). Internal arrays (e.g. jacobian) is the square of this product, 1E8! Knowing that the majority of problems would work with 1E'n' would provide a target value for future releases of Calculus compilers.

The next article will show an example Oil Production code model to get you thinking what all is involved in such a process. This example code is explained a little more in detail.



< < Back

Next > >